<template>
  <el-tabs v-model="activeName" @tab-click="handleClick">
    <el-tab-pane label="推荐" name="first">推荐</el-tab-pane>
    <el-tab-pane label="呼吸系统" name="second">呼吸系统</el-tab-pane>
    <el-tab-pane label="消化系统" name="third">消化系统</el-tab-pane>
    <el-tab-pane label="皮肤" name="fourth">皮肤</el-tab-pane>
    <el-tab-pane label="骨科" name="fifth">骨科</el-tab-pane>
    <el-tab-pane label="泌尿生殖系统" name="sixth">泌尿生殖系统</el-tab-pane>
    <el-tab-pane label="五官科" name="seventh">五官科</el-tab-pane>
    <el-tab-pane label="内科" name="eighth">内科</el-tab-pane>
    <el-tab-pane label="其他" name="ninth">其他</el-tab-pane>
  </el-tabs>
  <div class="infinite-list-wrapper" style="overflow:auto">
    <ul
        class="list"
        v-infinite-scroll="load"
        infinite-scroll-disabled="disabled">
      <li v-for="i in count" class="list-item">{{ i }}</li>
    </ul>
    <p v-if="loading">加载中...</p>
    <p v-if="noMore">没有更多了</p>
  </div>
</template>

<script>
export default {
  name: "HomeSymptom",
  data() {
    return {
      activeName: 'second',
      count: 10,
      loading: false
    };
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab, event);
    },
    load () {
      this.loading = true
      setTimeout(() => {
        this.count += 4
        this.loading = false
      }, 2000)
    }
  },
  computed: {
    noMore () {
      return this.count >= 20
    },
    disabled () {
      return this.loading || this.noMore
    }
  }
}
</script>

<style scoped>

</style>